from fastapi import APIRouter, Request
from pyJianYingDraft import CapCut_Transition_type, Transition_type, CapCut_Mask_type, Mask_type
from src.constants.resultcode import ResultCode
from .base import RouterMeta
import config
from src.utils.response import ApiResponse
from src.utils.logger import get_logger


logger = get_logger("capcut")

router = APIRouter()

@router.get("/mask_types",name="获取可用蒙版")
async def get_mask_types(request: Request):
    """
    获取转场动画
    """
    try:
        text_intro_types = []
        if config.IS_CAPCUT_ENV:
            for name, member in CapCut_Mask_type.__members__.items():
                text_intro_types.append({
                    "mask_name": name
                })
        else:
            for name, member in Mask_type.__members__.items():
                text_intro_types.append({
                    "mask_name": name
                })
        return ApiResponse.success(
            data=text_intro_types
        )
    except Exception as e:
        return ApiResponse.error(
            result_code=ResultCode.ERROR,
            message=f"获取可用蒙版: {str(e)}",
        )




# 路由元数据配置
meta = RouterMeta(
    router=router,
    prefix="/mask",
    tags=["蒙版"]
)